﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL
{
    public class WishlistsDataModel
    {
        HomestayWebDBEntities ent = new HomestayWebDBEntities();
        public bool CheckPostIsAddedToWishlist(string username,int postID)
        {
            List<Store_WistList_CheckPostIsAddedToWishlist_Result> l = ent.Store_WistList_CheckPostIsAddedToWishlist(username, postID).ToList();
            bool added = false;
            if (l.Count > 0)
            {
                added = true;
            }
            return added;
        }

        #region Hoangdx Code Wishlist

        public void AddWistList(int postID, string username)
        {
            Wishlist WistlistDB = new Wishlist()
            {
                PostID = postID,
                Username = username,
                TimeCreated = DateTime.Now
            };
            ent.Wishlists.AddObject(WistlistDB);
            ent.SaveChanges();
        }

        #endregion
    }
}
